package ctu.kfad.run.memory;

public class FieldClassHolder {

    FieldClassHolder(String fieldName, String className, String instanceClassName) {
        this.fieldName = fieldName;
        this.className = className;
        this.instanceClassName = instanceClassName;
    }

    final private String fieldName;
    final private String className;
    final private String instanceClassName;

    public String getFieldName() {
        return fieldName;
    }

    public String getClassName() {
        return className;
    }

    public String getInstanceClassName() {
        return instanceClassName;
    }

    @Override
    public boolean equals(Object o) {
        if (this == o) return true;
        if (o == null || getClass() != o.getClass()) return false;

        FieldClassHolder that = (FieldClassHolder) o;

        if (className != null ? !className.equals(that.className) : that.className != null) return false;
        if (fieldName != null ? !fieldName.equals(that.fieldName) : that.fieldName != null) return false;
        if (instanceClassName != null ? !instanceClassName.equals(that.instanceClassName) : that.instanceClassName != null)
            return false;

        return true;
    }

    @Override
    public int hashCode() {
        int result = fieldName != null ? fieldName.hashCode() : 0;
        result = 31 * result + (className != null ? className.hashCode() : 0);
        result = 31 * result + (instanceClassName != null ? instanceClassName.hashCode() : 0);
        return result;
    }
}